<!-- 重点参数：iconStyle -->
<!doctype html>
<html lang="zh-CN">

<head>
    <!-- 原始地址：//webapi.amap.com/ui/1.0/ui/misc/PositionPicker/examples/positionPicker2.html -->
    <base href="//webapi.amap.com/ui/1.0/ui/misc/PositionPicker/examples/"/>
    <meta charset="utf-8">
    <meta name="viewport" content="initial-scale=1.0, user-scalable=no, width=device-width">
    <title>自定义图标</title>
    <style>
        html,
        body {
            height: 100%;
            margin: 0;
            width: 100%;
            padding: 0;
            overflow: hidden;
            font-size: 13px;
        }

        .map {
            height: 100%;
            width: 100%;
        }

        button {
            border: solid 1px;
            margin-left: 15px;
            background-color: #dadafa;
        }

    </style>
</head>

<body>
<div id="container" class="map" tabindex="0"></div>
<script type="text/javascript"
        src='//webapi.amap.com/maps?v=1.4.10&key=7b5b68d8eedd376a331579722714be19&plugin=AMap.ToolBar'></script>
<!-- UI组件库 1.0 -->
<script src="//webapi.amap.com/ui/1.0/main.js?v=1.0.11"></script>
<script type="text/javascript">
    AMapUI.loadUI(['misc/PositionPicker'], function (PositionPicker) {
        var position = parent.document.getElementById('position').value
        var a = position.split(',')[0];
        var b = position.split(',')[0];

        var map = new AMap.Map('container', {
            zoom: 14,
            // scrollWheel: false
        })

        var positionPicker = new PositionPicker({
            mode: 'dragMarker',
            map: map,
        });
        positionPicker.on('success', function (positionResult) {
            var position = positionResult.position;
            var str = position.lng + ',' + position.lat;
            parent.document.getElementById('position').value = str;
            console.log(parent.document.getElementById('position').value)
        });
        positionPicker.start();
        map.addControl(new AMap.ToolBar({
            liteStyle: true
        }))
    });
</script>
</body>

</html>